home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / iconp.zip / LAM.ICN < prev    next >
Text File  |  1987-05-29  |  969b  |  51 lines

  1. #    LAM(1)
  2. #
  3. #    Laminate files
  4. #
  5. #    Thomas R. Hicks
  6. #
  7. #    Last modified 7/28/83
  8. #
  9.  
  10. global fndxs
  11.  
  12. procedure main(a)
  13.    local bufs, i
  14.    bufs := list(*a)
  15.    fndxs := []
  16.    if (*a = 0) | a[1] == "?" then Usage()
  17.    every i := 1 to *a do {
  18.       if a[i] == "-" then {
  19.          a[i] := &input
  20.             put(fndxs,i)
  21.             }
  22.       else if match("-",a[i]) then {
  23.          bufs[i] := a[i][2:0]
  24.          a[i] := &null
  25.          }
  26.       else {
  27.          if not (a[i] := open(a[i])) then
  28.             stop("Can't open ",a[i])
  29.          else put(fndxs,i)
  30.          }
  31.      }
  32.    if 0 ~= *fndxs then lamr(a,bufs) else Usage()
  33. end
  34.  
  35. procedure lamr(args,bufs)
  36.    local i, j
  37.    every i := !fndxs do
  38.       bufs[i] := (read(args[i]) | &null)
  39.    while \bufs[!fndxs] do {
  40.       every j := 1 to *bufs do
  41.          writes(\bufs[j])
  42.       write()
  43.       every i := !fndxs do
  44.          bufs[i] := (read(args[i]) | &null)
  45.      }
  46. end
  47.  
  48. procedure Usage()
  49.    stop("usage: lam file [file | -string]...")
  50. end
  51.